package com.ibeetl.admin.core.service;


import java.util.List;

import org.beetl.sql.core.engine.PageQuery;
import org.beetl.sql.core.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.dao.CoreCityDao;
import com.ibeetl.admin.core.entity.CoreCity;
import com.ibeetl.admin.core.util.PlatformException;






/**
 * CoreCity Service
 */

@Service
@Transactional
public class CoreCityService extends CoreBaseService<CoreCity>{

    @Autowired private CoreCityDao coreCityDao;

    public PageQuery<CoreCity>queryByCondition(PageQuery query){
        PageQuery ret =  coreCityDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }
    
    public CoreCity findBycode(String code) {
    	Query<CoreCity> query = sqlManager.query(CoreCity.class);
    	CoreCity city = query.andEq("code", code).single();
    	return city;
    }

    public void batchDelCoreCity(List<Long> ids){
        try {
            coreCityDao.batchDelCoreCityByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除CoreCity失败", e);
        }
    }
}